package com.sc.nft.admin.controller;

import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.entity.dto.AddUserRedPacketDTO;
import com.sc.nft.service.UserInterestsRedPacketService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/redpacket")
@Api(tags = "用户红包模块")
public class UserInterestsRedPacketController {
private final UserInterestsRedPacketService userInterestsRedPacketService;

    @PostMapping(value = "/addUserRedPacket", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "给用户定期发红包模块", notes = "给用户定期发红包模块", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result transferPage(@Valid @RequestBody AddUserRedPacketDTO addUserRedPacketDTO) {
        userInterestsRedPacketService.addUserRedPacket(addUserRedPacketDTO.getUserId(),addUserRedPacketDTO.getTime(),addUserRedPacketDTO.getPrice());
        return PageResult.success();
    }
}
